import java.util.Random;
import java.util.Scanner;

/**
 * Created with IntelliJ IDEA.
 * Description:
 * User: 沈明月
 * Date: 2022-11-02
 * Time: 10:08
 */
public class TestThree {
//猜数字游戏
    public static void main24(String[] args) {

        Scanner scanner = new Scanner(System.in);//读取数字

        Random random = new Random();

        int randNum = random.nextInt(100);//输入的时候直接写100,它会自己显示bound；生成的数的范围：【0，100）
        //int randNum = random.nextInt(50)+50;//范围：[50,100)
        //int randNum = random.nextInt(100)+100;//范围：[100,200)

        //System.out.println(randNum);

        while(true){
            System.out.println("请输入你要猜的数字：");
            int num=scanner.nextInt();
            if(num>randNum){
                System.out.println("猜大了！");
            }else if(num==randNum){
                System.out.println("猜对了！");
                break;
            }else{
                System.out.println("猜小了！");
            }
        }
    }
}
